<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>档案移交</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"
    />
    <link rel="stylesheet" href="../js/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="../style/admin.css" media="all"/>
    <link rel="stylesheet" href="../style/home.css" media="all"/>
    <script src="../js/layui/layui.js"></script>
    <style>
        .layui-form-item .layui-inline {
            padding-right: 0px;
            margin-right: 0px;
        }

    </style>
</head>
<body>
<div class="" style="padding: 20px;">
    <div class="layui-row layui-col-space15">
        <div class="layui-card pr20" style=" height: 530px">
            <form class="layui-form" lay-filter="postData" action="" id="postData">
                <input type="hidden" name="id" value="put" th:value="${data.id}"/>
                <input type="hidden" name="pid" value="put" th:value="${data.pid}"/>
                <input type="hidden" name="tid" value="put" th:value="${data.tid}"/>
                <div class="layui-col-xs6">
                    <label class="layui-form-label">接收批次</label>
                    <div class="layui-input-block">
                        <input type="text" name="batchCode" placeholder="请输入接收批次"
                               autocomplete="off" class="layui-input" required lay-verify="required"
                               th:value="${data.batchCode}"
                        />
                    </div>
                </div>

                <div class="layui-col-xs6">
                    <label class="layui-form-label">接收日期</label>
                    <div class="layui-input-block">
                        <input type="text" id="outDate" name="outDate" placeholder="请输入接收日期"
                               autocomplete="off" class="layui-input" required lay-verify="required"
                               th:value="${data.outDate}"
                        />
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <label class="layui-form-label">接收数量</label>
                    <div class="layui-input-block">
                        <input type="text" name="quantity" placeholder="请输入档案接收数量"
                               autocomplete="off" class="layui-input" required lay-verify="required"
                               th:value="${data.quantity}"
                        />
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <label class="layui-form-label">计量单位</label>
                    <div class="layui-input-block">
                        <select name="unit" lay-verify="required">
                            <option value=""></option>
                            <option value="卷" th:selected="${data.unit eq '卷'}">卷</option>
                            <option value="件" th:selected="${data.unit eq '件'}">件</option>
                            <option value="盒" th:selected="${data.unit eq '盒'}">盒</option>
                            <option value="箱" th:selected="${data.unit eq '箱'}">箱</option>
                        </select>
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <label class="layui-form-label">移交人</label>
                    <div class="layui-input-block">
                        <input type="text" name="outTransfer" placeholder="请输入移交人"
                               autocomplete="off" class="layui-input" required lay-verify="required"
                               th:value="${data.outTransfer}"
                        />
                    </div>
                </div>
                <div class="layui-col-xs6">
                    <label class="layui-form-label">接收人</label>
                    <div class="layui-input-block">
                        <input type="text" name="outReceive" placeholder="请输入接收人"
                               autocomplete="off" class="layui-input" required lay-verify="required"
                               th:value="${data.outReceive}"
                        />
                    </div>
                </div>


                <div class="layui-col-xs12">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <input type="text" name="remark" autocomplete="off" class="layui-input"
                               th:value="${data.remark}"
                        />
                    </div>
                </div>
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="postData"
                        id="postBut" style="display: none"
                >
                    保存
                </button>
            </form>
        </div>
    </div>
</div>
<script>
    var callBackReturn = false;
    var index = parent.layer.getFrameIndex(window.name);
    layui.use(['laydate', 'form'], function () {
        var $ = layui.$, form = layui.form;
        var laydate = layui.laydate;
        form.render();

        laydate.render({
            elem: '#outDate',
            theme: '#393D49',
        });

        form.on('submit(postData)', function (obj) {
            var data = obj.field;
            data["taskName"] = $("#task").find("option:selected").text();
            $.ajax({
                url: './saveArchivesReceiveData', //url
                contentType: 'application/json',
                dataType: 'json', //数据格式
                type: 'POST', //请求方式
                async: false, //是否异步请求
                data: JSON.stringify(data),
                success: function (result) {
                    if (result.code === 0) {
                        parent.layer.msg(result.message, {icon: 1});
                        callBackReturn = true;
                        parent.layer.close(index);
                    } else {
                        parent.layer.alert(result.message, {icon: 2});
                    }
                },
            });
            return false;
        });
    });


    function Submit() {
        document.getElementById('postBut').click();
        return callBackReturn;
    }
</script>
<script type="text/javascript" src="../js/lib/watermark.js"></script>
</body>
</html>
